• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp0
r3wp22
total:22

results window for this page: [start: 1 end: 22]

world-name: r3wp

Group: RAMBO ... The REBOL bug and enhancement database [web-public]
Joe:
15-Jan-2007
resize-image: func [
	dest [file!]
	size [pair!]
	file [file!]
	/local im
][	
	im:		load-image file
	save/png 	dest to-image layout [origin 0x0 image (im) (size)]
	im:		none
]
Group: View ... discuss view related issues [web-public]
yeksoon:
21-Sep-2006
quick question about images.

eg.

==
i1: load %image.jpg
i2: i1
i2/size: 300x300
save/png %a.png i2
===

why does the image comes out distorted?


what is the correct way to 'resize' an image and save it in a different 
format?
Brock:
31-Oct-2006
REBOL [
	Title: "REBOL Logo Maker"
	Purpose: "Generate a Hilight image"
	Author: ["Carl Sassenrath" "Gabriele Santilli"]
	Version: 1.0.0

 Rights: "REBOL logo is a registered trademark of REBOL Technologies, 
 USA."
]

debug?: false
hilight-colour: 255.0.0 ;0.112.99	;request-color
character: uppercase request-text
font-type: "font-sans-serif"
xthin-chars: charset "I!J"
thin-chars: charset "1234567890ABDEFPRSZ"
normal-chars: charset"CGHKLNOTUVXY"
wide-chars: charset "WMQ"
xwide-chars: charset ""
special-chars: charset "*"

if font-type = "font-serif"[
;get-char: func [character][

 if find character xthin-chars 	[if debug? [print "xthin"] char-offset: 
 8x2 char-size: 14]

 if find character thin-chars 	[if debug? [print "thin"] char-offset: 
 7x2 char-size: 14]

 if find character normal-chars	[if debug? [print "normal"] char-offset: 
 6x2 char-size: 14]

 if find character wide-chars	[if debug? [print "wide"] char-offset: 
 5x2 char-size: 14]

 if find character xwide-chars	[if debug? [print "xwide"] char-offset: 
 4x2 char-size: 14]

 if find character special-chars	[if debug? [print "special"] char-offset: 
 5x-2 char-size: 28]
;]
]
if font-type = "font-sans-serif"[
;get-char: func [character][

 if find character xthin-chars 	[if debug? [print "xthin"] char-offset: 
 9x2 char-size: 14]

 if find character thin-chars 	[if debug? [print "thin"] char-offset: 
 7x2 char-size: 14]

 if find character normal-chars	[if debug? [print "normal"] char-offset: 
 6x2 char-size: 14]

 if find character wide-chars	[if debug? [print "wide"] char-offset: 
 5x2 char-size: 14]

 if find character xwide-chars	[if debug? [print "xwide"] char-offset: 
 4x2 char-size: 14]

 if find character special-chars	[if debug? [print "special"] char-offset: 
 4x-2 char-size: 26]
;]
]



font-style: make face/font [style: 'bold  name: font-type  size: 
char-size]

hilights: [
	transform 0 1 1 0x0 0x0
	fill-pen snow pen snow
	circle 10x10 9
	fill-pen black pen black
	circle 13x13 9
	fill-pen hilight-colour	;0.112.99
	pen hilight-colour	;serve dark green - 0.112.99
	circle 11x11 9
	fill-pen white pen white
	font font-style
	text 1 char-offset character 
		;]
	;]
]



insert-event-func func [face evt][
	if evt/type = 'resize [
		bx/size: out/size: evt/offset
		bx/size/y: out/size/y: evt/offset/x / 23 * 23
		n: to-decimal bx/size/x / 23
		;t-x: to-decimal bx/size/x / 23 + 5
		;t-y: to-decimal bx/size/y / 23 - 2
;		probe highlights ;logo-shape
;		halt
		hilights/3: n
		hilights/4: n
		loc: to-pair :t-x :t-y
		show out
	]
	evt
]


view/options center-face out: layout [
	origin 0

 bx: box 23x23 green effect [draw hilights effect [key: green]][  
  ;logo-shape][	; 

  file: request-file/only/save/file join %hilight- [character ".png"]
		if not file [exit]
		if not find file ".png" [append file ".png"]
		save/png file to-image bx
	]
][resize]
Brock:
3-Nov-2006
I had problems with his version for resizine the image on the fly. 
 I didn't look at it very long.  I'm rethinking whether I need the 
resize feature as I will likely build a small GUI where are the parameters 
are set.
Joe:
15-Jan-2007
resize-image: func [
	dest [file!]
	size [pair!]
	file [file!]
	/local im
][	
	im:		load-image file
	save/png 	dest to-image layout [origin 0x0 image (im) (size)]
	im:		none
]
Geomol:
24-Mar-2008
If i1 is your original image, you can do:


i2: copy/part to-image layout [origin 0 image i1 as-pair i1/size/1 
100] 200x100

This will resize height to 100 and crop width to 200.
amacleod:
23-Feb-2009
How do I get the window to resize withthe image face?

pic1: load %pic.jpg
pic_size: 200x200
view/new lay: layout [pic: image pic1 pic_size]
wait 2
unview lay 
pic/size: 50x50
view/new lay
Henrik:
23-Feb-2009
you need to get a resize event from the window and apply that to 
the image. you can use INSERT-EVENT-FUNC for that.
Oldes:
3-Mar-2009
You don't need wrapper, but you cannot do: save-image %test.jpg to-image 
layout [button "hello world"]

Also IM can be used as a command line tool, which I was doing quite 
a long time. But finally I'm working on wrapper as it's faster than 
doing many calls to external app. Of course.. if you want to resize 
100 photos per year, you don't care if it's call or by using wrapper.
Steeve:
4-May-2009
Jocko, in R2 if you use effect dialect to resize images, yes it uses 
nearest interpolation.
But draw uses blinear by default.
see:

img: logo.gif
siz: img/size * 4
view layout [
	below
	image img
	image img siz effect [aspect]
	box siz effect [draw [image img 0x0 siz]]
]


In R3 it's annouced that  image-filter supports NEAREST,BILINEAR,BICUBIC 
and GAUSSIAN interpolation
Pekr:
21-Aug-2009
Is there an easy way of how to resize an image? I tried:

i1: load %my-img.png
i2: make image! 82x63 i1

but the image is black :-)
Pekr:
21-Aug-2009
What I need is smaller PNG, because SharePoint just sends original 
image to browser, instructing it to resize. IE is pretty much ugly, 
FF is OK. I tried in xnView, my friend in IrfanView, no matter what 
we do, we can't save so that it preserves transparent color ...
Nicolas:
20-Dec-2009
window: layout [i: image rate 5 load %gtfo.jpg key escape [halt]]

zoom-in: does [i/size: i/size * 5 / 4]
zoom-out: does [i/size: i/size * 4 / 5]
down: false
alt-down: false

insert-event-func [
	probe event/type
	switch/all event/type [
		down [down: true]
		up [down: false]
		time [if down [zoom-in]]		
		alt-down [alt-down: true]
		alt-up [alt-down: false]
		time [if down [zoom-in] if alt-down [zoom-out]]
	]
	center-face i
	show window
	event
]

view/options window [resize]
Nicolas:
20-Dec-2009
REBOL []


window: layout [i: image rate 5 load http://rebol.com/graphics/kits.jpg
key escape [halt]]

zoom-in: does [i/size: i/size * 5 / 4]
zoom-out: does [i/size: i/size * 4 / 5]
down: false
alt-down: false

insert-event-func [
	probe event/type
	switch/all event/type [
		down [down: true]
		up [down: false]
		time [if down [zoom-in]]		
		alt-down [alt-down: true]
		alt-up [alt-down: false]
		time [if down [zoom-in] if alt-down [zoom-out]]
	]
	center-face i
	show window
	event
]

view/options window [resize]
Geomol:
12-Jan-2010
Just a test:

set 'resize func [img /local sz c1 c3 i2] [
	if file? img [img: load-image img]

	scale: img/size/x / 160
	sz: as-pair 160 round img/size/y / scale
	c1: 1x0 * sz
	c3: 0x1 * sz


 i2: to-image layout [origin 0 box sz effect [draw [image img 0x0 
 c1 sz c3]]]
	save/png %img.png i2
]
Geomol:
12-Jan-2010
Call RESIZE with a loaded image. It'll save the img.png file, that'll 
have x-size of 160. It looks ok here.
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public]
RobertS:
31-Aug-2007
; I did a dif between the functions in VIEW and those in CORE for 
a default install.  What I get is this ( I hope it is useful to have 
al 106  in one place )

 alert  brightness?  caret-to-offset  center-face  choose  clear-face 
  clear-fields  confine  crypt-strength?

 dbug  deflag-face  desktop  dh-compute-key  dh-generate-key  dh-make-key 
  do-events  do-face  do-face-alt  do-thru  

 draw  dsa-generate-key  dsa-make-key  dsa-make-signature  dsa-verify-signature 
  dump-face  dump-pane  edge-size?  

 editor  emailer  exists-thru?  find-key-face  find-window  flag-face 
  flag-face?  flash  focus  get-face  

 get-net-info  get-style  hide  hide-popup  hilight-all  hilight-text 
  hsv-to-rgb  in-window?  inform  

 insert-event-func  inside?  install  launch-thru  layout  link-relative-path 
  load-image  load-stock  

 load-stock-block  load-thru  local-request-file  make-face  notify 
  offset-to-caret  open-events  outside?  

 overlap?  path-thru  read-net  read-thru  remove-event-func  request 
  request-color  request-date  request-dir  

 request-download  request-file  request-list  request-pass  request-text 
  reset-face  resize-face  rgb-to-hsv  

 rsa-encrypt  rsa-generate-key  rsa-make-key  screen-offset?  scroll-drag 
  scroll-face  scroll-para  set-face  

 set-font  set-para  set-style  set-user  show  show-popup  size-text 
  span?  stylize  textinfo  unfocus  

 uninstall  unlight-text  unview  vbug  view  viewed?  win-offset? 
  within?
Group: !RebGUI ... A lightweight alternative to VID [web-public]
Vincent:
4-Mar-2005
just a detail: in facets document, /span datatype is pair! . you 
could use it to store other data, but if you set a pair! to /span, 
/view will use it as virtual size for face (it still works in later 
betas, so one should be careful to not use it to store coordinates) 
ie:
f: layout [
   banner "Testing /span" guide 
   box 400x400 effect [gradient 1x1 0.0.0 255.255.255] 
   button "Hello!" return 
   text-list data ["just" "a" "list"] 
   image logo.gif logo.gif/size * 2
]

f/span: f/size  ; here we tells /view to use virtual coordinates 
for all subfaces

view/options f 'resize ; will give a fully resizable window (widgets 
included), but it only works for reducing window's size.
shadwolf:
29-Mar-2005
the ask is do we need to specify in hard coded way the resize of 
every image ...
Ashley:
31-Oct-2007
 Is there any way to circumvent this for items that need a specific 
 pixel size, in my case a picture?

 image defaults to size -1x-1 which means *not* specifying a size 
 will default it to the image size.


 Is it possible to resize the window when my picture is changed, so 
 that the new picture doesn't get resized to the previous one's size?
 This should get you going:

	display "" [
		button [face/parent-face/size: 320x240 show face/parent-face]
	]


Note that in this case the size *is* in pixels as you are modifying 
a face object directly (as opposed to specifying a wudget's *unit* 
size). Hope that helps.
Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public]
Janko:
30-Jul-2010
what would be the best way to resize and crop an image after it's 
uploaded on cheyenne .. using commandline imgmagick, I think oldes 
was making an magemagick binding once?, are there more light ways, 
can pure rebol do it?
Group: !REBOL3 GUI ... [web-public]
Pekr:
9-Sep-2010
In clean R3 A105 session, I do following to get following image:

do %r3-gui.r3
view [field] ; resize needed to see anything ...

result:
http://www.xidys.com/pekr/rebol/a105-field-strange-chars.jpg

Any idea?